Field of the Invention
The present invention relates to an HTTP server capable of setting an information processing apparatus via a USB interface, a method for controlling the same, and an image forming apparatus.
Description of the Related Art
Internet Printing Protocol (IPP) (RFC 2910 Internet Printing Protocol/1.1: Encoding and Transport, URL:https://tools.ietf.org/html/rfc2910) is known as a technique for printing to a remote printer connected via the Internet. A technique called “IPP over USB”, in which printing is performed to a printer connected to a PC via a USB interface using an IPP protocol is known as an expansion of the IPP. Meanwhile, a client residing outside a network segmented by a router cannot directly access a server that resides inside the network segmented by the router and has been given a private address. Accordingly, there is a technique called “port mapping”, in which an intermediate server for mediating the connection between the outside and the inside of the network (i.e., connection between networks) assigns the connection to the inside server based on the number of the port accessed from the outside (Japanese Patent Laid-Open No. 2005-31725).
In IPP over USB, when a web browser on a PC attempts to connect to a remote UI of an image forming apparatus (hereinafter, referred to as “MFP”) via a USB interface, the connection is realized via the following routes.
(1) On the PC, a virtual server is started for each MFP connected to a USB interface. For each MFP, an appropriate number (for example, 54321 or 54322) is assigned to the number of the port at which the virtual server runs.
(2) The web browser on the PC accesses the virtual server. At this time, an HTTP protocol has the host header “Host:localhost:54321” because the virtual server within the PC is to be accessed.
(3) The virtual server converts a request from the web browser into a USB packet without changing it, and transmits the request to the MFP using the USB interface.
(4) Upon receiving the packet from the USB interface, a USB-TCP conversion module that is running on the MFP converts data included in the USB packet directly into a TCP/IP packet. The converted packet is transmitted to an HTTP server that is running at the port with the number 8000 (port 8000) on the MFP, the HTTP server realizing the remote UI.
(5) The HTTP server attempts to process the request received from the USB-TCP conversion module, but the host header transmitted from the web browser on the PC is “Host:localhost:54321”.
Here, for the HTTP server running at the port 8000, the request with “Host:localhost:54321” is a bad request in HTTP, and thus the HTTP server cannot perform HTTP processing. The request received from the client via the virtual server can be prevented from being a bad request by starting, on the MFP, an HTTP server that runs at the port with the same port number as the port number (for example, 54321) of the port at which the virtual server on the PC runs.